import Ast
from decimal import Decimal


class Interpreter:

    __node: Ast.Ast = None

    def __init__(self, node: Ast.Ast):
        self.__node = node

    def evaluate(self, variable=None) -> Decimal:
        return self.__node.get_value(variable)

    def __str__(self):
        return self.__node.__str__()

    def __repr__(self):
        return self.__str__()

    def pprint(self):
        return self.__node.pprint()[1:-1]
